// 引入 react 依赖
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text, TextInput, View, Image, TouchableOpacity, ImageBackground, ScrollView, InteractionManager } from 'react-native';

// 引入第三方依赖
import _ from 'lodash';
import pureRender from 'pure-render-decorator';
import { Actions } from 'react-native-router-flux';

// antd 按需加载
import { Tabs, Toast } from '@ant-design/react-native';

// 引入 处理数据 所需文件
import { } from './module/module.js'

// 引入样式
import Style from './style/style.js';

// 引入公用组件
import { Status, NavBar } from '../../components/index.js'

// 引入专用组件
import { } from './components'

// 引入工具包
import { press, size, ScreenWidth, defaultDataList, onEndReached, onRefresh, concatDataList, defaultPage } from '../../util/utils.js'
class Register extends Component {

  constructor(props) {
    super(props);
    this.state = {
      send: '获取验证码',
      disable: false,
      checkSjh: null,
      checkSjhVisible: false,
      info: '',
    };
    // this.getUserTkQyk = getUserTkQyk.bind(this);
    // this.getUserInfo = getUserInfo.bind(this);
    // this.getUserLogin = getUserLogin.bind(this);
  }

  componentDidMount() {
    console.log(this.props)
  }

  render() {
    const { send } = this.state
    return (
      <View style={Style.container}>
        <Status />
        <NavBar
          title="注册"
          back={true}
        />
        <ScrollView style={Style.content}>
          <View style={{
            padding: size(30),
          }}
          >
            <Text style={{
              fontSize: 16, color: '#2f2f2f', lineHeight: 18,
              textAlign: 'center',
            }}
            >
              输入信息注册账号
            </Text>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
              marginTop: 0,
            }}
            >
              <TextInput
                // autoFocus
                placeholder="请输入用户名"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
            </View>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
              marginTop: 0,
            }}
            >
              <TextInput
                // autoFocus
                keyboardType="numeric"
                placeholder="请输入手机号"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
            </View>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
              marginTop: 0,
            }}
            >
              <TextInput
                // autoFocus
                placeholder="设置密码"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
            </View>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
              marginTop: 0,
            }}
            >
              <TextInput
                // autoFocus
                placeholder="确认密码"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
            </View>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
            }}
            >
              <TextInput
                placeholder="请输入验证码"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
              <TouchableOpacity
                onPress={() => press(() => this.sendYzm())}
              >
                <Text style={{ fontSize: 14, color: '#61676F', lineHeight: 16, }}>{send}</Text>
              </TouchableOpacity>
            </View>
            <View style={{
              flexDirection: 'row',
              alignItems: 'center',
              borderBottomWidth: 1,
              borderBottomColor: '#ececee',
              marginTop: 0,
            }}
            >
              <TextInput
                // autoFocus
                placeholder="邀请码（选填）"
                placeholderTextColor="#c8c8ca"
                style={{
                  flex: 1,
                  fontSize: 16,
                  paddingVertical: 16,
                  borderWidth: 0,
                  paddingHorizontal: 5,
                  color: '#3e3e3e',
                }}
                underlineColorAndroid="transparent"
              />
            </View>
            <TouchableOpacity
              activeOpacity={0.9}
              onPress={() => press(() => this.login())}
              style={{
                marginTop: 15,
                paddingVertical: 14,
                paddingHorizontal: 20,
                backgroundColor: '#ffd100',
                borderRadius: 23,
                alignItems: 'center',
                justifyContent: 'center',
                marginBottom: 15,
              }}
            >
              <Text style={{ fontSize: size(28), color: '#333333', lineHeight: size(30), }}>登录</Text>
            </TouchableOpacity>
          </View>
        </ScrollView>
      </View >
    );
  }
}


export default connect(({ user }) => ({
  user,
}))(pureRender(Register))
